from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from utils import SERVER_PORT,SERVER_HOST,retriveal_qdrant
from server import all_server_app


app=FastAPI(
    title="OpenBA-Server",
    version="1.0",
    description="OpenBA后台接口",
)

app.include_router(all_server_app)

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],  # 允许访问的源
    allow_credentials=True,  # 支持 cookie
    allow_methods=["*"],  # 允许使用的请求方法
    allow_headers=["*"]  # 允许携带的 Headers
)

if __name__=="__main__":

    import uvicorn

    uvicorn.run(app,host=SERVER_HOST,port=SERVER_PORT)